package com.jake.demo.jpa.entity;

import com.fasterxml.jackson.annotation.JsonIgnore;
import lombok.Data;

import javax.persistence.*;

@Data
@Entity
@Table(name = "player_team",
        uniqueConstraints = {@UniqueConstraint(columnNames = {"year", "pid", "tid"})})
public class PlayerTeam {

    @Id
    @JsonIgnore
    private Integer ptid;

    private Integer year;

    @ManyToOne
    @JoinColumn(name = "pid")
    private Player player;

    @ManyToOne
    @JoinColumn(name = "tid")
    private Team team;

}
